<template>
	<view class="inforamtion" style="display: flex;">
		<view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">发票号码</view>
				<view class="rl">{{ item.invoiceNo }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">开票日期</view>
				<view class="rl">{{ item.createTime }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">发票类型</view>
				<view class="rl">{{ item.invoiceCategory_dictText }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">税率</view>
				<view class="rl">{{ item.contractRateType_dictText }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">开票金额(元)</view>
				<view class="rl">{{ item.invoiceAmount }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">备注</view>
				<view class="rl">{{ item.remark }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">发票附件</view>
				<view class="rl">
					<view v-if="item.attachments" style="flex: 0 1 auto;">
						<u-button
							type="primary"
							:plain="true"
							text="文件列表"
							size="mini"
							style="width: 200rpx;"
							@click="handleFile(item.attachments)"></u-button>
					</view>
				</view>
			</view>
		</view>
		<!-- <view  style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
			<u-icon name="edit-pen-fill" color="#2979ff" size="20" @click="handleEidtForm(item)"></u-icon>
			<u-line  direction="col" length="20" margin="0 10rpx"></u-line>
			<u-icon name="trash-fill" color="#2979ff" size="20" @click="handleRemoveForm(item)"></u-icon>
		</view> -->
		<file-modal ref="fileModalRef"></file-modal>
	</view>
</template>

<script>
import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
import fileModal from '@/components/fileModal/fileModal.vue'
export default {
  name: 'InvoiceFormInfo',
	components: {
		fileModal
	},
	data() {
	  return {
	    filterMultiDictText,
	    initDictOptions,
	    dictOptions: {},
	  }
	},
  props: {
    formType: {
      type: String,
      default: 'basic',
    },
    index: {
      type: Number,
      default: null,
    },
    item: {
      type: Object,
      default: () => ({}),
    },
  },
	watch: {
	  item: {
	    handler(val) {
	      if (val) {
	        this.initDictConfig()
	      }
	    },
	    immediate: true,
	    deep: true,
	  },
	},
  methods: {
		initDictConfig() {
			
		},
    handleEidtForm(item) {
      this.$emit('edit', [item, this.index])
    },
    handleRemoveForm(item) {
      uni.showModal({
        content: '确定删除吗？',
        success: (res) => {
          if (res.confirm) {
            this.$emit('remove', item)
          }
        },
      })
    },
		// 点击预览文件
		handleFile (val) {
			this.$refs.fileModalRef.showModal(val)
		}
  },
}
</script>

<style scoped lang="scss">
.inforamtion {
  margin-top: 10rpx;
  padding: 10rpx;
  border-radius: 15rpx;
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.1);
}
</style>
